package eu.connect.jmswrapper.test;

import java.util.LinkedList;
import java.util.List;

import eu.connect.jmswrapper.ConnectJMSCallerProxyFactory;
import eu.connect.jmswrapper.TargetHost;

public class EnablerCaller {
	
	public static void main(String args[]){
		try {
			ITest callerProxy = (ITest)ConnectJMSCallerProxyFactory.createJMSCallerProxy("ITest");
			
			TargetHost.setHost("localhost");
			
			System.out.println(callerProxy.print("hello", "world"));
			
			TestParaClass para = new TestParaClass();
			para.name = "Ma Yun";
			para.num = 3;
			System.out.println(callerProxy.getName(para));
			
			callerProxy.setName("123");
			
			List<String> l = new LinkedList();
			l.add("the first");
			l.add("the second");
			l.add("the third");
			System.out.println(callerProxy.testList(l));
			
			String[] sa = new String[]{"abc","def","ghi"};
			String[] ra = callerProxy.testArray(sa);
			System.out.println(ra[2]);
			
			callerProxy.testException("0");
			callerProxy.testException("1");
			
		} catch (TestException e)
		{
			System.out.println(e.code);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
